﻿using log4net;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WMSSyncData.Core;

namespace WMSSyncRMData
{
    public class SyncRMJob : IJob
    {
        private readonly ILog _logger = LogManager.GetLogger(typeof(SyncRMJob));
        public void Execute(IJobExecutionContext context)
        {

            new Thread(() =>
            {
                try
                {
                    _logger.Info("WMERPToSSyncRM.InStockRMSync作业执行开始!");
                    new SyncRMERPData().SyncInStockRMData();
                    _logger.Info("WMERPToSSyncRM.InStockRMSync作业执行结束!");
                }
                catch (Exception)
                {
                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("WMERPToSSyncRM.OutStockRMSync作业执行开始!");
                    new SyncRMERPData().SyncOutStockRMData();
                    _logger.Info("WMERPToSSyncRM.OutStockRMSync作业执行结束!");
                }
                catch (Exception)
                {
                }
            }).Start();

            new Thread(() =>
            {
                try
                {
                    _logger.Info("WMERPToSSyncRM.PRSync生产退料作业执行开始!");
                    new SyncRMERPData().SyncProductReturnData();
                    _logger.Info("WMERPToSSyncRM.PRSync生产退料作业执行结束!");
                }
                catch (Exception)
                {
                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("WMERPToSSyncRM.SyncProductOfMaterialsData生产领料作业执行开始!");
                    new SyncRMERPData().SyncProductOfMaterialsData();
                    _logger.Info("WMERPToSSyncRM.SyncProductOfMaterialsData生产领料作业执行结束!");
                }
                catch (Exception)
                {
                }
            }).Start();
            //new Thread(() =>
            //{
            //    _logger.Info("WMERPToSSyncRM.SyncProductOfMaterialsByERPBomData从ERPBOM获取生产领料作业执行开始!");
            //    new SyncRMERPData().SyncProductOfMaterialsByERPBomData();
            //    _logger.Info("WMERPToSSyncRM.SyncProductOfMaterialsByERPBomData从ERPBOM获取生产领料作业执行结束!");
            //}).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("WMERPToSSyncRM.SyncUpdateMdcDatVStorageData退料明细更新作业执行开始!");
                    new SyncRMERPData().SyncUpdateMdcDatVStorageData();
                    _logger.Info("WMERPToSSyncRM.SyncUpdateMdcDatVStorageData退料明细更新作业执行结束!");
                }
                catch (Exception)
                {
                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("WMERPToSSyncRM.SyncUpdateInventoryData外发订单扣料更新作业执行开始!");
                    new SyncRMERPData().SyncUpdateInventoryData();
                    _logger.Info("WMERPToSSyncRM.SyncUpdateInventoryData外发订单扣料更新作业执行结束!");
                }
                catch (Exception)
                {
                }
            }).Start();

        }

    }
}
